<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我要投稿 - 应急防护小站</title>
    <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
    <style>
        .ql-editor { min-height: 300px; }
        .ql-toolbar { border-top-left-radius: 0.5rem; border-top-right-radius: 0.5rem; }
        .ql-container { border-bottom-left-radius: 0.5rem; border-bottom-right-radius: 0.5rem; }
    </style>
</head>
<body class="bg-gray-50 min-h-screen text-gray-900">
    <div style="color:purple;">投稿JSP已加载</div>
    <% System.out.println("submit-article.jsp loaded"); %>
    
    <!-- 顶部导航栏 -->
    <nav class="bg-white shadow-sm sticky top-0 z-40">
        <div class="max-w-7xl mx-auto flex items-center justify-between px-4 h-16">
            <div class="flex items-center space-x-2">
                <i class="fa-solid fa-shield-alt text-green-600 text-2xl"></i>
                <span class="text-xl font-bold">应急防护小站</span>
            </div>
            <div class="flex items-center space-x-2">
                <a href="index.jsp" class="px-4 py-2<%=(request.getRequestURI().endsWith("index.jsp") ? " text-green-600 border-b-2 border-green-600 font-medium" : " hover:text-green-600")%>" ><i class="fa-solid fa-house mr-1"></i>首页</a>
                <a href="quiz.jsp" class="px-4 py-2<%=(request.getRequestURI().endsWith("quiz.jsp") ? " text-green-600 border-b-2 border-green-600 font-medium" : " hover:text-green-600")%>" ><i class="fa-solid fa-question-circle mr-1"></i>答题功能</a>
                <a href="${pageContext.request.contextPath}/books" class="px-4 py-2<%=(request.getRequestURI().endsWith("books.jsp") ? " text-green-600 border-b-2 border-green-600 font-medium" : " hover:text-green-600")%>" ><i class="fa-solid fa-cart-shopping mr-1"></i>图书购买</a>
                <a href="user-profile.jsp" class="px-4 py-2<%=(request.getRequestURI().endsWith("user-profile.jsp") ? " text-green-600 border-b-2 border-green-600 font-medium" : " hover:text-green-600")%>" ><i class="fa-solid fa-user mr-1"></i>个人信息</a>
                <a href="submit-article.jsp" class="px-4 py-2<%=(request.getRequestURI().endsWith("submit-article.jsp") ? " text-green-600 border-b-2 border-green-600 font-medium" : " hover:text-green-600")%>" ><i class="fa-solid fa-pen-to-square mr-1"></i>我要投稿</a>
                <a href="feedback.jsp" class="px-4 py-2<%=(request.getRequestURI().endsWith("feedback.jsp") ? " text-green-600 border-b-2 border-green-600 font-medium" : " hover:text-green-600")%>" ><i class="fa-solid fa-comment-dots mr-1"></i>问题反馈</a>
            </div>
        </div>
    </nav>
    
    <!-- 主内容区 -->
    <main class="max-w-4xl mx-auto px-4 py-12">
        <div class="bg-white rounded-2xl shadow-lg p-8">
            <h2 class="text-2xl font-bold mb-8 flex items-center text-purple-700">
                <i class="fa-solid fa-pen-to-square text-purple-600 mr-3"></i> 我要投稿
            </h2>
            
            <form action="submit-article" method="post" enctype="multipart/form-data" onsubmit="return submitArticle()" class="space-y-6">
                <div>
                    <label class="block mb-2 font-medium text-gray-700">文章标题</label>
                    <input type="text" name="title" required 
                           class="w-full border border-gray-300 rounded-lg px-4 py-3 focus:outline-none focus:ring-2 focus:ring-purple-400 focus:border-transparent" 
                           placeholder="请输入文章标题">
                </div>
                <div>
                    <label class="block mb-2 font-medium text-gray-700">灾害类型</label>
                    <select name="type" required 
                            class="w-full border border-gray-300 rounded-lg px-4 py-3 focus:outline-none focus:ring-2 focus:ring-purple-400 focus:border-transparent">
                        <option value="">请选择类型</option>
                        <option value="地震防护">地震防护</option>
                        <option value="火灾防护">火灾防护</option>
                        <option value="台风防护">台风防护</option>
                        <option value="洪水防护">洪水防护</option>
                        <option value="极端天气">极端天气</option>
                        <option value="雪灾防护">雪灾防护</option>
                        <option value="山体滑坡">山体滑坡</option>
                        <option value="疫情防护">疫情防护</option>
                        <option value="综合防护">综合防护</option>
                    </select>
                </div>
                <div>
                    <label class="block mb-2 font-medium text-gray-700">正文内容（可插入图片）</label>
                    <div id="editor" class="bg-white border border-gray-300 rounded-lg"></div>
                    <input type="hidden" name="content" id="content-input">
                    <p class="text-gray-500 text-sm mt-2">支持富文本编辑，可以插入图片、设置格式等</p>
                </div>
                <div class="flex items-center justify-between pt-4">
                    <a href="index.jsp" class="text-gray-500 hover:text-purple-600 flex items-center">
                        <i class="fa-solid fa-arrow-left mr-1"></i> 返回首页
                    </a>
                    <button type="submit" 
                            class="bg-purple-600 hover:bg-purple-700 text-white px-8 py-3 rounded-lg font-bold text-lg transition duration-200 flex items-center">
                        <i class="fa-solid fa-paper-plane mr-2"></i> 提交投稿
                    </button>
                </div>
            </form>
        </div>
    </main>
    
    <!-- 底部信息区 -->
    <footer class="bg-gray-900 text-white py-10 mt-16">
        <div class="max-w-7xl mx-auto px-4">
            <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
                <div>
                    <div class="flex items-center space-x-2 mb-4">
                        <i class="fa-solid fa-shield-alt text-purple-400 text-2xl"></i>
                        <span class="text-xl font-bold">应急防护小站</span>
                    </div>
                    <p class="text-gray-400 text-sm mb-4">守护生命安全</p>
                    <div class="flex space-x-4">
                        <a href="#" class="text-gray-400 hover:text-white"><i class="fa-brands fa-weibo"></i></a>
                        <a href="#" class="text-gray-400 hover:text-white"><i class="fa-brands fa-weixin"></i></a>
                        <a href="#" class="text-gray-400 hover:text-white"><i class="fa-brands fa-twitter"></i></a>
                    </div>
                </div>
                <div>
                    <h3 class="text-lg font-medium mb-4">防护分类</h3>
                    <ul class="space-y-2 text-gray-400">
                        <li><a href="disaster-earthquake.jsp" class="hover:text-white">地震防护</a></li>
                        <li><a href="disaster-fire.jsp" class="hover:text-white">火灾防护</a></li>
                        <li><a href="disaster-typhoon.jsp" class="hover:text-white">台风防护</a></li>
                        <li><a href="disaster-flood.jsp" class="hover:text-white">洪水防护</a></li>
                        <li><a href="disaster-extremeheat.jsp" class="hover:text-white">极端天气</a></li>
                    </ul>
                </div>
                <div>
                    <h3 class="text-lg font-medium mb-4">快速链接</h3>
                    <ul class="space-y-2 text-gray-400">
                        <li><a href="#about" class="hover:text-white">关于我们</a></li>
                        <li><a href="submit-article.jsp" class="hover:text-white">我要投稿</a></li>
                        <li><a href="${pageContext.request.contextPath}/books" class="hover:text-white">防护用品</a></li>
                        <li><a href="feedback.jsp" class="hover:text-white">问题反馈</a></li>
                        <li><a href="#" class="hover:text-white">隐私政策</a></li>
                    </ul>
                </div>
                <div>
                    <h3 class="text-lg font-medium mb-4">订阅我们</h3>
                    <p class="text-gray-400 text-sm mb-4">订阅我们的防护周刊，获取最新应急资讯</p>
                    <div class="flex">
                        <input type="email" placeholder="输入您的邮箱" class="px-4 py-2 rounded-l-lg w-full focus:outline-none focus:ring-2 focus:ring-purple-400">
                        <button class="bg-purple-600 hover:bg-purple-700 text-white px-4 rounded-r-lg"><i class="fa-solid fa-paper-plane"></i></button>
                    </div>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-500 text-sm">
                <p>&copy; 2025 应急防护小站. 保留所有权利.</p>
            </div>
        </div>
    </footer>
    
    <script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
    <script>
        var quill = new Quill('#editor', {
            theme: 'snow',
            placeholder: '请输入文章内容...',
            modules: {
                toolbar: [
                    [{ 'header': [1, 2, 3, false] }],
                    ['bold', 'italic', 'underline', 'strike'],
                    [{ 'list': 'ordered'}, { 'list': 'bullet' }],
                    ['blockquote', 'code-block'],
                    ['link', 'image'],
                    [{ 'color': [] }, { 'background': [] }],
                    [{ 'align': [] }],
                    ['clean']
                ]
            }
        });
        
        function submitArticle() {
            document.getElementById('content-input').value = quill.root.innerHTML;
            return true;
        }
    </script>
</body>
</html> 